package com.sinosoft.app.entrust.biz.imp;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sinosoft.app.entrust.biz.EntrustAssetsBiz;
import com.sinosoft.app.entrust.dao.EntrustAssetsDao;
import com.sinosoft.app.entrust.entity.EntrustAssets;
import com.sinosoft.system.util.page.Pagenation;

@Service
@Transactional
public class EntrustAssetsBizImp implements EntrustAssetsBiz{

	private static Logger log = Logger.getLogger(EntrustAssetsBizImp.class);
	
	@Autowired
	private EntrustAssetsDao entrustAssetsDao;
	
	@Override
	public int insertEntrustAssets(EntrustAssets entrustAssets) {
		log.info("新增EntrustAssets数据"+entrustAssets.toString());
		return entrustAssetsDao.insertEntrustAssets(entrustAssets);
	}

	@Override
	public int updateEntrustAssets(EntrustAssets entrustAssets) {
		log.info("更新EntrustAssets数据"+entrustAssets.toString());
		return entrustAssetsDao.updateEntrustAssets(entrustAssets);
	}

	@Override
	public int deleteEntrustAssets(int id) {
		log.info("删除EntrustAssets数据 id="+id);
		return entrustAssetsDao.deleteEntrustAssets(id);
	}

	@Override
	public EntrustAssets selectEntrustAssets(int id) {
		log.info("根据ID查询EntrustAssets数据 id="+id);
		return entrustAssetsDao.selectEntrustAssets(id);
	}

	@Override
	public EntrustAssets selectEntrustAssets(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询EntrustAssets数据 ");
		return entrustAssetsDao.selectEntrustAssets(queryKeys, queryValues);
	}

	@Override
	public int selectCountEntrustAssets() {
		log.info("查询EntrustAssets数据 总数量");
		return entrustAssetsDao.selectCountEntrustAssets();
	}

	@Override
	public int selectCountEntrustAssets(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询EntrustAssets数据 总数量"+queryKeys.toString());
		return entrustAssetsDao.selectCountEntrustAssets(queryKeys, queryValues);
	}

	@Override
	public List<EntrustAssets> selectLimitEntrustAssets(int start, int size) {
		log.info("查询EntrustAssets数据 limit数量:start="+start+",size="+size);
		return entrustAssetsDao.selectLimitEntrustAssets(start, size);
	}

	@Override
	public List<EntrustAssets> selectLimitEntrustAssets(List<String> queryKeys,List<Object> queryValues,int start, int size) {
		log.info("条件查询EntrustAssets数据数量");
		return entrustAssetsDao.selectLimitEntrustAssets(queryKeys, queryValues, start,  size);
	}

	@Override
	public List<EntrustAssets> selectAllEntrustAssets() {
		log.info("查询所有EntrustAssets数据");
		return entrustAssetsDao.selectAllEntrustAssets();
	}

	@Override
	public List<EntrustAssets> selectAllEntrustAssets(List<String> queryKeys,List<Object> queryValues) {
		log.info("条件查询所有EntrustAssets数据");
		return entrustAssetsDao.selectAllEntrustAssets(queryKeys, queryValues);
	}

	@Override
	public Pagenation selectPageEntrustAssets(Pagenation page) {
		log.info("分页查询所有EntrustAssets数据");
		int start =	page.getStartRow();
		int size = page.getPageSize();
		List<EntrustAssets> rows = entrustAssetsDao.selectLimitEntrustAssets(page.getQueryKeys(), page.getQueryValues(),start,size);
		int total = entrustAssetsDao.selectCountEntrustAssets(page.getQueryKeys(), page.getQueryValues());
		page.setTotal(total);
		page.setRows(rows);
		return page;
	}

	public EntrustAssetsDao getEntrustAssetsDao() {
		return entrustAssetsDao;
	}

	public void setEntrustAssetsDao(EntrustAssetsDao entrustAssetsDao) {
		this.entrustAssetsDao = entrustAssetsDao;
	}

}
